#include "GLCribbage.h"

GLCribbage::GLCribbage(QWidget *parent) :
    QGLWidget(parent) {
    setFixedSize(QSize(GL_WIDTH, GL_HEIGHT));
}

void GLCribbage::initializeGL() {
    qglClearColor(QColor(255, 255, 255));
    glDisable(GL_DEPTH_TEST);
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glShadeModel(GL_FLAT);
}

void GLCribbage::paintGL() {
    glClear(GL_COLOR_BUFFER_BIT);
}

void GLCribbage::resizeGL(int width, int height) {
    glViewport(0, 0, width, height);
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, width, 0, height, -1, 1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    glTranslatef(0.5f, 0.5f, 0.0f);
}
